package com.jingsong.studentapp.adapter;
/*
 * @author zei , QQ:77132995, email:kazeik@163.com
 * 2021-12-17 22:55
 * 类说明:
 */

import android.content.Context;
import android.util.SparseArray;
import android.view.View;

import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;

public class KBaseViewHolder extends RecyclerView.ViewHolder {
    private SparseArray<View> views = new SparseArray();
    private Context _context;

    public Context getContext() {
        return _context;
    }

    public KBaseViewHolder(@NonNull View itemView, Context context) {
        super(itemView);
        this._context = context;
    }

    public View getViewById(int viewId) {
        View view = views.get(viewId);
        if (view == null) {
            view = itemView.findViewById(viewId);
            views.put(viewId, view);
        }
        return view;
    }
}
